
<style>
    #con_m_list li {width:90px; overflow: hidden; float: left; margin-bottom: 10px; font-size: 12px; line-height: 20px;}
    .current-set {color: red; font-weight: 700;}
</style>

<input type='hidden' id='sequence'/>
<div id='region-treelist-<{$sid}>-loading'></div>
<div id='region-treelist-<{$sid}>' class='x-tree-list'></div>



<div id="region-treelist" class="x-tree-list" style="padding-left:10px;width:600px;">
<{input type="checkbox" name="checkAll" id="checkAll"}>全选
<ul id='con_m_list'>
<{foreach from=$regionlist item=region}>
<li>
<span class="node">
<span class="node-handle" pid="0" nid="<{$region.region_id}>" hasc="0"> </span>
<span class="node-line"> </span>
<input type="checkbox" name="region" value="<{$region.region_id}>" pid="0" <{if in_array($region.region_id , $region_ids,true) }>checked<{/if}>>
<span class=""> </span>
<span class="node-names "><{$region.local_name}></span>
</span>
</li>
<{/foreach}>
</ul>
</div>

<div class="table-action">
  <{button id="dlg_ok" class="btn btn-primary" label=$___eccommon="确定"|t:'eccommon'}>
  <{button id="dlg_cancel-{$sid}" class="btn btn-secondary" label=$___eccommon="取消"|t:'eccommon' onclick="window.close();"}>
</div>

<script>
var sequence=$('sequence');
var sequence_dialog=sequence.getParent('div');

$('dlg_ok').addEvent('click',function(){

  var nodes=sequence_dialog.getElements('.node').filter(function(n){
 
        return n.getElement('input[type=checkbox]').checked;
      });
 var IDdatas=[];
      var Namedatas=[];
      nodes.each(function(node){
		var v = node.getElement('input[type=checkbox]').getValue();
		 IDdatas.push(v);

        var text = node.getElement('.node-names').get('text');

          Namedatas.push(text);
      });

$('p_region_id').set('value',IDdatas.join(','));
$('p_region_name').set('value',Namedatas.join(','));
$('dlg_ok').getParent('.dialog').retrieve('instance').close();
 });


$('checkAll').addEvent('click',function(e){

if (this.checked==true)
{
sequence_dialog.getElements('input[name=region]').each(function(i,index){
    
i.set('checked',true);

});
}else{
sequence_dialog.getElements('input[name=region]').each(function(i,index){
    
i.set('checked',false);
});
}

});
</script>
